-
-
Notifications
You must be signed in to change notification settings - Fork 166
North West | Zabihollah Namazi | Module-Structuring-and-Testing-Data | Sprint 3 #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
North West | Zabihollah Namazi | Module-Structuring-and-Testing-Data | Sprint 3 #123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your hard work here @ZabihollahNamazi . Don't forget to enrol as a trainee .
Overall, there's an underlying problem here with your approach. What this coursework is trying to show you is that we want to build up our solutions in a systematic, test-first way. This means I am looking for you to convert each statement in the assignment into a test and then write just enough code to pass that test.
For example,
// Proper Fraction check:
// Input: numerator = 2, denominator = 3
// target output: true
// Explanation: The fraction 2/3 is a proper fraction, where the numerator is less than the denominator. The function should return true.
// written as a test
console.assert(isProperFraction(2,3) === true)
// written into the function
function isProperFraction(numerator, denominator) {
if (numerator > denominator) return false
return true
}
and then go on to the next condition, writing the test first each time. You can build on these tests later, making the error message more useful and using test syntax like in https://nodejs.org/api/test.html but for now work on the coding strategy itself.
if(a + b <= c || a + c <= b || b + c <= a){ | ||
return false | ||
} | ||
// else if(a + b >= c || a + c >= b || b + c >= a){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this commented out?
In general, unless you have a question about it, don't commit commented out code
else if(angle == 180){ | ||
return "Straight angle" | ||
} | ||
else if(angle > 180 && angle < 360){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this return Reflex angle? What test could you write to check this?
@@ -29,3 +29,31 @@ | |||
// Given a card with an invalid rank (neither a number nor a recognized face card), | |||
// When the function is called with such a card, | |||
// Then it should throw an error indicating "Invalid card rank." | |||
|
|||
function getCardValue(card){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there's quite a lot to do here. In the assignment there are many tests and criteria defined. Your code should address each criterion systematically. How will you do this?
console.log(isProperFraction(3, 5)); | ||
|
||
let currentOutput = isProperFraction(2, 3); | ||
let targetOutput = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too, I am looking for a sequence of assertions that check the assertions made in the coursework.
This is a great thing to take to pair programming sessions and work through systematically with a pair. You can use driver navigator pattern to build up your solution.
@@ -16,13 +16,42 @@ | |||
// Given a lowercase letter character and a positive integer shift, | |||
// When the function is called with these inputs, | |||
// Then it should rotate the lowercase letter by shift positions within the lowercase alphabet, wrapping around if necessary, and return the rotated lowercase letter as a string. | |||
let ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "U", "V", "w", "x", "y", "z"]; | |||
let ALPHABET_UPPERCASE = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Instead of using two arrays here, could I use one and operate on each character with a string method?
hi
please if you can check my PR.
thanks